// 导入发送登录的axios的接口
import { userLogin } from '@/api/user'

// 导入本地存储的接口
import { setToken, getToken } from '@/utils/storage'
export default {
  namespaced: true,
  state: {
    Token: getToken()
  },
  getters: {
  },
  mutations: {
    upUser (state, payload) {
      state.Token = payload
      setToken(payload)
    }
  },
  actions: {
    async getUser (context, payload) {
      const data = await userLogin(payload)
      console.log(data)
      context.commit('upUser', data.data.token)
    }
  }

}
